import request from '@/utilities/request';

// 获取商品列表
export const commodityGetListService = (reqData) =>
  request.post('/api/Commodity/GetCommodityList', reqData);

// 获取商品详情
export const getCommodityDetail = (reqData) =>
  request.post('/api/Commodity/GetCommodityDetail', reqData);

// 新增商品
export const addCommodity = (reqData) =>
  request.post('/api/Commodity/addCommodity', reqData);

// 上传商品主图
export const uploadCommodityMainImage = (img) =>
  request.post('/api/Commodity/UploadCommodityMainImage', img, {
    headers: { 'Content-Type': 'multipart/form-data' }
  });

// 修改商品
export const editCommodityMain = (reqData) =>
  request.post('/api/Commodity/EditCommodityMain', reqData);

// 上传商品轮播图
export const uploadCommoditySlideShowImage = (img) =>
  request.post('/api/Commodity/uploadCommoditySlideShowImage', img, {
    headers: { 'Content-Type': 'multipart/form-data' }
  });

// 修改商品轮播图
export const editCommoditySlideShowImages = (reqData) =>
  request.post('/api/Commodity/editCommoditySlideShowImages', reqData);

// 上传 SKU 图片
export const uploadCommoditySKUImage = (img) =>
  request.post('/api/Commodity/UploadCommoditySKUImage', img, {
    headers: { 'Content-Type': 'multipart/form-data' }
  });

// 修改 SKU
export const editCommoditySKU = (reqData) =>
  request.post('/api/Commodity/EditCommoditySKU', reqData);

// 删除商品
export const deleteCommodity = (reqData) =>
  request.post('/api/Commodity/DeleteCommodity', reqData);

// 获取商品分类（全部）
export const getAllCommodityCategoryList = () =>
  request.post('/api/commodity/GetAllCommodityCategoryList', {});

// 获取商品分类（分页）
export const commodityCategoryListService = (reqData) =>
  request.post('/api/commodity/getCommodityCategoryList', reqData);

// 新增/编辑 商品分类
export const commodityCategoryEditService = (reqData) =>
  request.post('/api/commodity/editCommodityCategory', reqData);

// 删除商品分类
export const categoryDeleteService = (reqData) =>
  request.post('/api/commodity/DeleteCommodityCategory', reqData);
